package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Ninth_c;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Ninth_cMapper {
    @Select({
            "select",
            "*",
            "from Ninth_c",
            "where hospital = #{hospital,jdbcType=VARCHAR} and department = #{department,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Ninth_c> selectByName(Ninth_c record);
    @Delete({
            "delete from Ninth_c",
            "where hospital = #{hospital,jdbcType=VARCHAR} and department = #{department,jdbcType=VARCHAR}"
    })
    int deleteByName(Ninth_c record);

    int insertBatch(List<Ninth_c> item);
    @Delete({
        "delete from ninth_c",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into ninth_c (hospital, department, ",
        "type, c_type, count)",
        "values (#{hospital,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, ",
        "#{type,jdbcType=VARCHAR}, #{cType,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Ninth_c record);

    int insertSelective(Ninth_c record);

    @Select({
        "select",
        "id, hospital, department, type, c_type, count",
        "from ninth_c",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Ninth_c selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Ninth_c record);

    @Update({
        "update ninth_c",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "department = #{department,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "c_type = #{cType,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Ninth_c record);
}